#include <windows.h>
#include "stdio.h"
#include "sort.h"
#include "greedy.h"
 
int main()
{
  SetConsoleOutputCP(CP_UTF8);
    // int array1[] = {1, 2, 3, 4, 5};
    // int array2[] = {5, 4, 3, 2, 1};
    // int array3[] = {5, 1, 4, 1, 3};

    // qs(array1, 5);
    // qs(array2, 5);
    // qs(array3, 5);

    // 3台机器，5个任务
    // int m = 3;
    // int n = 5;
    // int tasks[] = {10, 8, 7, 6, 4}; // 任务时间从大到小排序

    // // 预期结果：13
    // scheduling_problem(tasks, n, m);
    // int r= scheduling_problem2(tasks, n, m);
    //printf("%d",r);

      // 测试用例1: 基本测试
      char *str1 = "abcdefg";
      char *str2 = "zcdexy";
      printf("LCS长度: %d\n", longest_common_substring(str1, str2));  // 应输出3 ("cde")
      
      // 测试用例2: 完全匹配
      char *str3 = "hello";
      char *str4 = "hello";
      printf("LCS长度: %d\n", longest_common_substring(str3, str4));  // 应输出5
      
      // 测试用例3: 无匹配
      char *str5 = "abc";
      char *str6 = "xyz";
      printf("LCS长度: %d\n", longest_common_substring(str5, str6));  // 应输出0
      
      // 测试用例4: 多个匹配取最长
      char *str7 = "ababc";
      char *str8 = "babac";
      printf("LCS长度: %d\n", longest_common_substring(str7, str8));  // 应输出3 ("bab")

      int weights[] = {2, 3, 4};
      int values[] = {3, 4, 5};
      int w = 5;
      int len = sizeof(weights) / sizeof(weights[0]);
  
      int maxValue = knapstack01(weights, values, w, len);
      printf("最大价值是111：%d\n", maxValue);
     
}